#ifndef __TEXTURE2D_H__
#define __TEXTURE2D_H__
/////////////////
//include
/////////////////
#include"DeviceContext.h"
/////////////////
//const
/////////////////

/////////////////
//class
/////////////////

class Texture2D
{
public:
	struct VertexInfo
	{
		Vector3D vertex;
		float alpha;
		float uv[2];
		VertexInfo(Vector3D vertex = Vector3D(),float alpha = 1.0f,float u = 0,float v = 0)
		{
			this->vertex= vertex;
			uv[0] = u;
			uv[1] = v;
			this->alpha = alpha;
		}
	};
	Texture2D(ID3D11ShaderResourceView* resource,float width = 0,float height = 0);
	~Texture2D();
	ID3D11Buffer* GetBuffer();
	ID3D11ShaderResourceView* GetShaderResourceView();
	Vector2D GetSize(){return Vector2D(width,height);}
	Vector2D GetCenterPos(float big_width,float big_height){return GetSize().GetCenter(Vector2D(big_width,big_height));}
	Rect GetRect(const Vector2D& pos){return Rect(pos.x+width/2,pos.y+height/2, width,height);}
private :
	VertexInfo square[4];
	float width;
	float height;
	ID3D11Buffer* buffer;
	ID3D11ShaderResourceView* resource;

};
#endif __TEXTURE2D_H__
